﻿/*
    MAST -- A file Merging and Splitting Tool
    Copyright (C) 2011 Harry Rose

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace FileMergeAndSplitTool
{
    /// <summary>
    ///     Represents a file that may or may not exist on the filesystem.  This is similar to FileInfo, except we can inherit from it.
    /// </summary>
    public abstract class MAST_File : FileSystemInfo
    {
        FileInfo fileInfo;
        /// <summary>
        ///     Associated FileInfo object
        /// </summary>
        public FileInfo FileInfo
        {
            get { return fileInfo; }
        }

        /// <summary>
        ///     Returns whether or not this file exists.
        /// </summary>
        public override bool Exists
        {
            get { return fileInfo.Exists; }
        }

        /// <summary>
        ///     The file name of the file (i.e. not including directory)
        /// </summary>
        public override string Name
        {
            get { return fileInfo.Name; }
        }

        /// <summary>
        ///     The full path to the file including its filename
        /// </summary>
        public override string FullName
        {
            get
            {
                return fileInfo.FullName;
            }
        }

        /// <summary>
        ///     The file extension of the file.
        /// </summary>
        public string Extension
        {
            get { return fileInfo.Extension; }
        }

        public MAST_File(string filename)
        {
            fileInfo = new FileInfo(filename);
        }

        /// <summary>
        ///     Delete the file from the filesystem
        /// </summary>
        public override void Delete()
        {
            fileInfo.Delete();
        }
    }
}
